#!/usr/bin/env python

# 创建一个空的bytes
b1 =bytes()
b2 = b""
b3 = b"hello"
print(b3)
print(b3[0])
print(b3[2:4])

# 抵用bytes方法将字符串转换成bytes对象
b4 = bytes('我爱python编程', encoding='utf-8')
print(b4)

# 利用字符串的encode方法编码成bytes，默认使用utf-8字符集
b5 = "学校python很有趣".encode('utf-8')
print(b5)
